<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="../static/bootstrap/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="../static/css/base.css"/>
    <link rel="stylesheet" href="../static/css/index.css"/>

</head>
<body>
<%--<div class="head" style="background-image: url(../img/bg_header_index_top.png); height: 50px">--%>
<%--    <div class="container-fluid">--%>
<%--        <!-- Brand and toggle get grouped for better mobile display -->--%>
<%--        <div class="navbar-header">--%>
<%--            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"--%>
<%--                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">--%>
<%--                <span class="sr-only">Toggle navigation</span>--%>
<%--                <span class="icon-bar"></span>--%>
<%--                <span class="icon-bar"></span>--%>
<%--                <span class="icon-bar"></span>--%>
<%--            </button>--%>
<%--            <a class="navbar-brand" href="#">此处是logo</a>--%>
<%--        </div>--%>

<%--        <!-- Collect the nav links, forms, and other content for toggling -->--%>
<%--        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">--%>
<%--            <ul class="nav navbar-nav" style="margin-right: 2px">--%>
<%--                <li><a href="#">首页</a></li>--%>
<%--                <li><a href="http://localhost:8888/html/allhotel.html">国内酒店</a></li>--%>
<%--                <li><a href="#">国外酒店</a></li>--%>
<%--                <li><a href="#">特卖专区</a></li>--%>
<%--                <li class="active"><a href="http://localhost:8888/html/index.html">旗下品牌</a></li>--%>
<%--                <li><a href="#">华住会</a></li>--%>
<%--                <li><a href="#">华住商旅</a></li>--%>
<%--            </ul>--%>

<%--            <ul class="nav navbar-nav navbar-right">--%>
<%--                <li style="margin-right: 30px;margin-top: 10px">--%>
<%--                    <button type="button" class="btn btn-primary small " style=";height: 30px;width:70px">登录</button>--%>
<%--                </li>--%>
<%--                <li style="margin-right: 30px;margin-top: 10px">--%>
<%--                    <button type="button" class="btn btn-default small active" style=";height: 30px;width:70px">注册--%>
<%--                    </button>--%>
<%--                </li>--%>
<%--            </ul>--%>
<%--        </div>--%>
<%--    </div>--%>
<%--</div>--%>
<div id="top1" class="container-fluid">
    <div class="row" style="margin-left: 5%;margin-right: 5%">
        <nav class="navbar" role="navigation">
            <div class="container-fluid" >
                <div class="navbar-header">
                    <p class="navbar-brand" style="font-size: 30px;">会员登录</p>
                </div>
                <div class="collapse navbar-collapse">
                    <ul class="nav navbar-nav navbar-right">
                        <li>
                            <a href="#">了解更多</a>
                        </li>
                        <li>
                            <a href="#">反馈信息</a>
                        </li>
                        <li>
                            <a href="#">english</a>
                        </li>
                    </ul>

                </div>
            </div>
        </nav>
    </div>
</div>
<div class="container-fluid">
    <div class="row col-md-12" style="margin-top: 60px;">
        <div class="col-md-5 col-md-offset-1">
            <form id="form1" class="form-horizontal" action="" method="post">
                <div class="form-group inputpadding">
                    <label for="input1" class="col-sm-2 control-label">用户名</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="userName" id="input1" placeholder="用户名">
                    </div>
                </div>
                <div class="form-group inputpadding">
                    <label for="input2" class="col-sm-2 control-label">密码</label>
                    <div class="col-sm-10">
                        <input type="password" class="form-control" name="password" id="input2" placeholder="密码">
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="button" class="btn btn-danger col-md-12" onclick="login()" >log in</button>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <p id="warningtip" class="col-md-12" style="text-align: center;color: red" ></p>
                    </div>
                </div>
            </form>
        </div>
        <div class="col-md-offset-2 col-md-3">
            <p class="textpadding">还未注册？<button class="btn" onclick="regist()">点击注册</button></p>
            <p class="textpadding">忘记密码？<button class="btn" onclick="getpass()">找回密码</button></p>
            <p class="textpadding">使用合作网站账号登录：<br/>
                <button class="btn btn-danger" style="width: 40%">qq登录</button>
                <button class="btn btn-primary" style="width: 40%">wb登录</button>
                <br/>
                <button class="btn btn-info" style="width: 40%">al登录</button>
                <button class="btn btn-success" style="width: 40%">wx登录</button>
            </p>
            <p class="textpadding">您可以使用航空公司/银行卡快速注册<br/>
                <button class="btn">合作卡登录</button></p>
            <p class="textpadding">您也可以为企业申请公司会员办卡<br/>
                <button class="btn">企业卡申请</button></p>
        </div>
    </div>
</div>

<div class="container-fluid">
    <div class="row" style="margin-top: 30px; background-color: #f5f5f5;height: 110px;" >
        <div class="col-md-6 col-md-offset-3" >
            <div class="col-md-2" style="text-align: center;margin-top: 30px;">
                <a href="#">网站介绍</a>
            </div>
            <div class="col-md-2" style="text-align: center;margin-top: 30px;">
                <a href="#">酒店加盟</a>
            </div>
            <div class="col-md-2" style="text-align: center;margin-top: 30px;">
                <a href="#">职位招聘</a>
            </div>
            <div class="col-md-2" style="text-align: center;margin-top: 30px;">
                <a href="#">意见反馈</a>
            </div>
            <div class="col-md-2" style="text-align: center;margin-top: 30px;">
                <a href="#">联系我们</a>
            </div>
        </div>

    </div>

</div>

<script src="../static/bootstrap/js/jquery-3.3.1.js"></script>
<script>
    function login(){
        $("#warningtip").text("")

        console.log($('#form1').serialize())
        var userdate = []
        var userName = $('#input1').val()
        var password = $('#input2').val()
        userdate.push(userName)
        userdate.push(password)
        var jsondate = JSON.stringify(userdate);
        console.log(jsondate)


        $.ajax({
            url:"/user/login",
            type:"post",
            data:$('#form1').serialize(),
            dataType:"text",
            success:function (data) {
                console.log(data)
                if(data=="success"){
                    location.href = "/user/loginsuccess"
                } else if(data=="ufail"){
                    $("#warningtip").text("用户名不存在")
                } else if (data=="pfail"){
                    $("#warningtip").text("密码错误")
                } else if (data=="space"){
                    $("#warningtip").text("用户名或密码不能为空")
                }
            }
        })
    }

    function regist() {

        location.href = "/regist"
    }

    function getpass(){

        location.href = "/iforget"

    }
</script>
</body>
</html>